/* 
 * Copyright 2014 Josef Hertl.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package caetus.pkcs11.tokenCapabilities;

/**
 * This enum lists the possible capabilities that are checked. Includes
 * particular capabilities and their categorization into groups.
 *
 * @author Josef Hertl
 */
public enum TokenCapability {

    SYMMETRIC_ENCRYPTION_DECRYPTION(TokenCapabilityGroup.SYMMETRIC_CRYPTOGRAPHY),
    SYMMETRIC_KEY_GENERATION(TokenCapabilityGroup.SYMMETRIC_CRYPTOGRAPHY),
    /**
     * If a key ISK (created symmetric key) is in the model. ISK is presumed to
     * be known by the intruder.
     */
    CREATE_SYMMETRIC(TokenCapabilityGroup.SYMMETRIC_CRYPTOGRAPHY),
    ASYMMETRIC_KEY_GENERATION(TokenCapabilityGroup.ASYMMETRIC_CRYPTOGRAPHY),
    ASYMMETRIC_ENCRYPTION_DECRYPTION(TokenCapabilityGroup.ASYMMETRIC_CRYPTOGRAPHY),
    CREATE_ASYMMETRIC(TokenCapabilityGroup.ASYMMETRIC_CRYPTOGRAPHY),
    CHANGE_KEY_ATTRIBUTES(TokenCapabilityGroup.CHANGING_KEY_ATTRIBUTES),
    WRAPPING_SYMMETRIC_BY_SYMMETRIC(TokenCapabilityGroup.WRAPPING_KEYS),
    WRAPPING_ASYMMETRIC_BY_SYMMETRIC(TokenCapabilityGroup.WRAPPING_KEYS),
    WRAPPING_SYMMETRIC_BY_ASYMMETRIC(TokenCapabilityGroup.WRAPPING_KEYS),
    WRAPPING_ASYMMETRIC_BY_ASYMMETRIC(TokenCapabilityGroup.WRAPPING_KEYS),
    /**
     * If SK can be used for decryption.
     */
    SYMMETRIC_WRAPPING_KEY_CAN_DECRYPT(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If SK can be used for wrapping. It will usually be true.
     */
    SYMMETRIC_WRAPPING_KEY_CAN_WRAP(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If SK can be used for unwrapping
     */
    SYMMETRIC_WRAPPING_KEY_CAN_UNWRAP(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If LSK can be used for decryption
     */
    SYMMETRIC_HIDDEN_KEY_CAN_DECRYPT(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If ISK can be used for decryption
     */
    SYMMETRIC_CREATED_KEY_CAN_DECRYPT(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If LSK can be used for unwrapping
     */
    SYMMETRIC_CREATED_KEY_CAN_UNWRAP(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If PrK can be used for decryption
     */
    ASYMMETRIC_WRAPPING_KEY_CAN_DECRYPT(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If PuK can be used for wrapping
     */
    ASYMMETRIC_WRAPPING_KEY_CAN_WRAP(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If LPrK can be used for decryption
     */
    ASYMMETRIC_HIDDEN_KEY_CAN_DECRYPT(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If PrK can be used to unwrap LPrK.
     */
    ASYMMETRIC_WRAPPING_KEY_CAN_UNWRAP(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If IPrK can be used for decryption.
     */
    ASYMMETRIC_CREATED_KEY_CAN_DECRYPT(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * If IPrK can be used for unwrapping.
     */
    ASYMMETRIC_CREATED_KEY_CAN_UNWRAP(TokenCapabilityGroup.SPECIFIC_KEY_ATTRIBUTES),
    /**
     * An obvious weakness that tests the model checker actually works. It
     * simply sends the hidden secret key in plain.
     */
    OBVIOUS_WEAKNESS(TokenCapabilityGroup.WEAKNESS),;

    private TokenCapability(TokenCapabilityGroup capabilityGroup) {
        this.capabilityGroup = capabilityGroup;
    }
    private final TokenCapabilityGroup capabilityGroup;

    public TokenCapabilityGroup getCapabilityGroup() {
        return capabilityGroup;
    }
}
